<template>
  <div class="tab_bar_container">
      <div v-for="(item, index) in items" :key="index" @click="onClick(item,index)"
      :class="{'active':isActive==index}"
      >
        <div class="navs-item">
          <span :class="item.icon"></span>
          <span>{{item.title}}</span>
        </div>
      </div>
  </div>
</template>
<script>
export default {
  props: {
    items: {
      type: Array,
      // required:true,
      validator: function (array) {
        //验证函数
        return array.length <= 6;
      },
    },
  },
  data(){
    return{
      isActive:0
    }
  },
   methods:{
      onClick(item,index){
        this.$router.push(item.path)
        this.isActive = index
      }
    }
};
</script>
<style scoped>
.tab_bar_container{
    bottom: 0px;
    height: 60px;
    width: 100%;
    border-top: 1px solid rgba(128, 128, 128, 0.103);
    background-color: #fff;
    position: fixed;
    display: flex;
    justify-content: space-around;
    align-items: center;
}
/* .tab_bar_wrapper{
    width: 40px;
    height: 40px;
    border: 1px solid #000;

} */
.navs-item{
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  align-content: center;
}
.active{
  color: red;
}
</style>